//
//  HomeNoticeCell.m
//  NormalFramework
//
//  Created by beisheng03 on 2018/3/8.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "HomeNoticeCell.h"
#import <SDCycleScrollView/SDCycleScrollView.h>

@interface HomeNoticeCell ()<SDCycleScrollViewDelegate>

@property (nonatomic, weak) SDCycleScrollView *cycleView;

@end

@implementation HomeNoticeCell

- (void)awakeFromNib {
    [super awakeFromNib];
//    self.contentView.backgroundColor = randomColor;
    [self setupSubViews];
    // Initialization code
}

- (void)setupSubViews{
    
    UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 44)];
    
    img.backgroundColor = [UIColor orangeColor];
    
    [self.contentView addSubview:img];
    
//            // 情景三：图片配文字
//        NSArray *titles = @[@"新建交流QQ群：185534916 ",
//                                @"感谢您的支持，如果下载的",
//                                @"如果代码在使用过程中出现问题",
//                                @"您可以发邮件到gsdios@126.com",
//                                @"纯文字上下滚动轮播",
//                                @"纯文字上下滚动轮播 -- demo轮播图4"
//                                ];
    
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(100, 0, KScreenW - 100, 44) delegate:self placeholderImage:nil];
    _cycleView = cycleScrollView;
    _cycleView.titleLabelBackgroundColor = [UIColor whiteColor];
    _cycleView.titleLabelTextColor = colorWith(72, 72, 72);
    cycleScrollView.scrollDirection = UICollectionViewScrollDirectionVertical;
    cycleScrollView.onlyDisplayText = YES;
    cycleScrollView.userInteractionEnabled = NO;
    cycleScrollView.titleLabelTextFont = MYFONT(14);
    
    [self.contentView addSubview:cycleScrollView];
    
    
}


- (void)setModels:(NSArray<HomeNoticeModel *> *)models{
    _models = models;
    
    
    _cycleView.titlesGroup = [_models valueForKeyPath:@"prise_desc"];
    
    
    
    
}



#pragma mark - SDCycleScrollViewDelegate

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    NSLog(@"---点击了第%ld张图片", (long)index);
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
